Zip function is not reading my text file at all
Zip function is not reading my text file at all
I have a long text file converted from ASCII, and I want to read its columns to display them on the screen. I tried using the following code for short file , worked perfectly:
with open(file_source) as f:
textfile_handler = zip(*[line.split() for line in f])
input = user_i.split()
#User_i is entered by user for the column number
##################################
#Printing columns numbers
print "n n"
for cols in input:
print " " + cols + "t",
print "n"
print (" " + "__" + "t") * len(input)
print "n"
############################
for line in ele_str:
#print ele_printer
for column in input:
print (" " + textfile_handler[int(column) - 1][int(line) - 1] + "t"),
print "n"
Worked perfectly, right? cool.
– Marcus.Aurelianus
29 secs ago
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
What's your question?
– jonrsharpe
1 min ago