Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
import xlrd
path = input('enter the path')
data = xlrd.open_workbook(r'path)
The program doesn't work ,the reason is 'path' does not exist.
So what is the correct way to write the code?
import xlrd
path = input('enter path:')
data = xlrd.open_workbook(path)
This is supposed to work, your issue is you pass a string that just says 'path' instead of the path variable that has the path.
You can use a relative or absolute path.
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 days ago.
Improve this question
The following code must be updated to the full file path on your computer. The ‘r’ must proceed the file name so backslash characters are not interpreted as escape characters.
here is what i am trying to put in:
poke = pd.read_csv(r'DriveLetter\full path\Pokemon.csv')
type(poke)
This is what its telling me:
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I am trying to rename a file in downloads folder and I get (I translate)
OSError: [WinError 123] Syntax of filename, catalog name or label is wrong: 'C:\\Users\\Miaoulis\\Downloads\\feed.xml' -> 'C:\\Users\\Miaoulis\\Downloads\\VECTOR_03-10-2020 16:49_new.xml'
using windows 10, Kaspersky Internet Security and the following
import os
src = 'C:\\Users\\Miaoulis\\Downloads\\feed.xml'
dst = 'C:\\Users\\Miaoulis\\Downloads\\VECTOR_'+str(file_date)+'_new.xml'
if os.path.isfile(src):
os.rename(src, dst)
thank you
The destination file name has a colon. Try renaming without colon.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I have seen the answers/recommendations for this questions.
I promise that I do not have a random.py file named on my computer. I have searched it, tried to delete it will the send2trash module as well as os.unlink. I simply do not get it. I am unable to call the random.randit() because of this issue. Also when I call os.cwd() the file path does not exist on my computer. I again, have no idea how this is possible.
The code would be random.randint(), not random.randit()
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
Let's assume I have a string:
a="qihdkasf\sdgbsdf\rgsdg"
I want to replace "\" in string a with "/" in python.
I do know that while printing "\", we need to write it as print("\\"). Considering that,
I tried doing something like this, as shown below:
a.replace("\\","/")
but, it doesn't seem to be working!
Any help on the matter will be really appreciated.
you can use:
r"qihdkasf\sdgbsdf\rgsdg".replace('\\', '/')
output:
qihdkasf/sdgbsdf/rgsdg
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
When I try to create and write to a text file only an empty file is created. Here is the code:
controlCheck = open("resources/controlType.txt", "w")
controlCheck.write("controller")
controlCheck.close()
Any idea what the problem is? Its driving me crazy.
Whenever python writes a file, it erases all former data.There are ways to get around it, such as using: what is talked about here: Opening a file for append