Mar-15-2021, 07:24 PM
In the following program, which I did not write myself, I am puzzled by something.
The code is:
How are these single quotes different in python 3.8.2?
When are they different?
In other computer languages when putting the single quotes around something, both
must be used and in a specific order.
In the little python program I have shown only the single quote next to the enter key works - it is used twice. There may be other combinations, but I am just unsure how both quotes are used in python.
So what is (are) the rule(s)?
Thanks
LZ
The code is:
import feather import pandas as pd import numpy as np a = np.random.randn(1000000) df = pd.DataFrame({'Field_{0}'.format(i): a for i in range(10)}) df.head() get_ipython().run_line_magic('time', "feather.write_dataframe(df, 'feather.file')")I am curious about the single quotes around 'Field_{0}'. It only runs when they are the same. The single quote in right hand side of the keyboard next to the enter key. There is another single quote in the upper left hand corner below the escape key which is not used.
How are these single quotes different in python 3.8.2?
When are they different?
In other computer languages when putting the single quotes around something, both
must be used and in a specific order.
In the little python program I have shown only the single quote next to the enter key works - it is used twice. There may be other combinations, but I am just unsure how both quotes are used in python.
So what is (are) the rule(s)?
Thanks
LZ