我有一个python脚本,该脚本查看文件夹中特定单词的所有文件,并将该单词替换为空格。我不想在每次运行脚本后更改要查看的单词,而是希望继续为脚本添加新单词以查找并执行相同的替换动作。
我正在macOS El Capitan上运行它。下面是脚本:
import os
paths = (os.path.join(root, filename)
for root, _, filenames in os.walk('/Users/Test/Desktop/Test')
for filename in filenames)
for path in paths:
# the '#' in the example below will be replaced by the '-' in the filenames in the directory
newname = path.replace('.File',' ')
if newname != path:
os.rename(path, newname)
for path in paths:
# the '#' in the example below will be replaced by the '-' in the filenames in the directory
newname = path.replace('Generic',' ') …Run Code Online (Sandbox Code Playgroud) 遵循Ruby on Rails的Stripe设置文档(https://stripe.com/docs/checkout/rails),它表示在启动应用程序时将创建config / initializers / stripe.rb。
我已关闭服务器并重新启动服务器多次,但是未在文档中标识的路径下创建此文件。
我究竟做错了什么?感谢帮助。