When writing a simple for loop like so:
for x in f
where f is the name of a file object, how does Python "know" to interpret
the variable x as a line of text, rather than,say, an individual character
in the file? Does it automatically
treat text files as sequences of lines?
--
Code to build a list z to contain all the first words in each line of a
text file:
z=[]
f=open('C:/atextfile.txt')
for aLine in f:
str=aLine
a=str.split()
z.append(a)
I would like to work further with the list z once the file has been
stripped, and the list is complete but am so clueless ab
ss
to find out how to do it.
--
Mayo Adams
mayoad...@gmail.com
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
cerned.
Any pointers would make me happy.
--
Mayo Adams
mayoad...@gmail.com
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
__
> Tutor maillist - Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
--
Mayo Adams
287 Erwin Rd.
Chapel Hill, NC 27514
(919)-968-7889
mayoad...@gmail.com
g that matters in this context.
>
> It is relevant to the assignment if the student hadn't noticed
> that the date was human readable. I was hoping to correct this
> possible misapprehension resulting from the poor assignment
> language.
>
> --
> Neil Cerutti
n't
really help.
--
Mayo Adams
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Many thanks to some very bright and helpful gentlemen.
On Fri, Jun 28, 2019 at 9:24 AM Mats Wichmann wrote:
> On 6/27/19 11:24 PM, Mayo Adams wrote:
> > I have for some time been flummoxed as to the significance of setting
> > environment variables, for example in order