I need some help with this current problem with my homework. One if the requirements is to print a csv file without the []
and ''
.
I've tried ','.join
and that hasn't worked. not sure what else to do.
import csv
def Main():
myfile = open('Challenges_2.csv','r')
with open('Challenges_2.csv', 'r') as options:
reader = csv.reader(options)
for row in reader:
x = 0
for x in range (0,1):
print(row)
It would print the challenges as:
Challenge 1 Calculator
Challenge 2 Area
Challenge 3 Volume
You were close with ','.join
, but since you want them separated by spaces it should be ' '.join
:
for row in reader:
print(' '.join(row))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.