前提・実現したいこと
python datetimeでURLの文字列の中に日付を入れたいです。
C:\Users\names\Desktop\test としたいのですがエラーがでます。
分かる方教えて頂けますでしょうか?
発生している問題・エラーメッセージ
File "<ipython-input-46-95887703615b>", line 5 print(r'C:\Users\names\Desktop\'+test) ^ SyntaxError: EOL while scanning string literal
該当のソースコード
import datetime now = datetime.datetime.today() test='{}年{}月'.format(now.year, now.month) print(test) print(r'C:\Users\names\Desktop\'+test)
試したこと
print(r'C:\Users\names\Desktop'+test) とすると「C:\Users\names\Desktop2020年1月」となってしまいます。
補足情報(FW/ツールのバージョンなど)
python3.7
windows10
ジュピターノートブック使用
回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/01/22 05:36