Hi,
1] How to input some column in idle
like:
a
a
a
2] I want to combine a series of files like
a.txt
1 a
2 a
3 a
b.txt
1 b
2 b
3 b
into one as:
a b
a b
a b
The work-in-progress code as following,
#!/usr/bin/python3
import os
INFILEEXT = .xvg
NUM_OF_FILE = 10
if __name__==__main__:
On 23 December 2011 10:01, lina lina.lastn...@gmail.com wrote:
Hi,
1] How to input some column in idle
like:
a
a
a
2] I want to combine a series of files like
a.txt
1 a
2 a
3 a
b.txt
1 b
2 b
3 b
into one as:
a b
a b
a b
The work-in-progress code as following,
On 23/12/11 10:01, lina wrote:
with open(filename,r) as f:
for line in f:
parts = f.readline().strip()
Are you sure you want to do this?
You are already reading a line from the file in the for loop.
This will read the next line. So parts will comprise
On Fri, Dec 23, 2011 at 6:42 PM, Alan Gauld alan.ga...@btinternet.com wrote:
On 23/12/11 10:01, lina wrote:
with open(filename,r) as f:
for line in f:
parts = f.readline().strip()
Are you sure you want to do this?
You are already reading a line from the
#!/usr/bin/python3
import os
INFILEEXT = .xvg
NUM_OF_FILES = 2
if __name__==__main__:
result = [ [] for i in range(NUM_OF_FILES)]
for i in range(NUM_OF_FILES):
filename = A_mindist_ + str(i+1) + INFILEEXT
#text = open(filename,r).readlines()
with
On 23/12/11 11:02, lina wrote:
for i in range(len(result)):
for j in range(len(result[i])):
print(result[i][j])
You don't need all the indexing.
Use Pythons for loop to get the items:
for group in result:
for item in group:
print item, # comma
On Fri, Dec 23, 2011 at 3:31 PM, lina lina.lastn...@gmail.com wrote:
Hi,
[SNIPPED]
2] I want to combine a series of files like
a.txt
1 a
2 a
3 a
b.txt
1 b
2 b
3 b
into one as:
a b
a b
a b
Is this ok?
On 2011-12-23 12:02, lina wrote:
for i in range(len(result)):
for j in range(len(result[i])):
print(result[i][j])
still have a little problem about print out,
I wish to get like
a a
b b
c c
which will show in the same line,
not as
a
b
c
a
b
c
So you wish to print
On Fri, Dec 23, 2011 at 8:19 PM, Andreas Perstinger
andreas.perstin...@gmx.net wrote:
On 2011-12-23 12:02, lina wrote:
for i in range(len(result)):
for j in range(len(result[i])):
print(result[i][j])
still have a little problem about print out,
I wish to get like