#๐Ÿ”’ very simple thing

32 messages ยท Page 1 of 1 (latest)

fathom juncoBOT
#

@chilly widget

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

chilly widget
#

where is

#

my file?????????????

#

literally

#

๐Ÿคทโ€โ™‚๏ธ

royal holly
# chilly widget my file?????????????

Have you looked in C:/Users/zinif?

See the CMD prompt. That shows your "working directory", what we think of as "where your programme runs".
If you open a file with a relative pathname like "swew.txt" that is where the realtive pathname starts from.

chilly widget
#

THANK U SO MUCH

#

๐Ÿ™

#

LIFE SAVER NGL

royal holly
#

Youu can, if you wish, issue cd command at the CMD prompt to change the working directory. To where you want your programme to do its work.

chilly widget
#

i wanna change into my folder

royal holly
#

If you mean the folder with your code, try typing:

cd Downloads/Python
chilly widget
#

yaa i did itt

royal holly
#

Observe the change in the prompt.

chilly widget
#

๐Ÿ™ THANKSS

royal holly
#

One more thing.

chilly widget
#

hmm?

royal holly
#

The common convention for opening a file is like this:

with open("swew.txt", "w", encoding="utf-8") as f:
    f.write("some text")

The with will close the file automatically for you, even if something goes wrong.

#

Note the stuff using f is indented to be "inside" the with

chilly widget
#

ohhh well in school teacher thought us all to use

#

that other way

#

so yeah

royal holly
#

ok

chilly widget
#

SO YEAH THANK YOU A LOT

#

GUIY

#

:P

fathom juncoBOT
#
Python help channel closed using Discord native close action

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.