I am new to python,can anybody please explain the following syntax,
for i in [line.split('"') for line in open('a.txt')]:
......
......
......
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The file
a.txtis opened and read line by lineFor each line from the file, the line is split on the
"characters –> we’ll call these tokens.The lines of code in the indented block presumably use these tokens somehow
In a nutshell, tis would parse the contents of a file into token delimited with either newline characters or quotation mark characters.
If the input file is:
.. the program would would return the tokens: