小编tkb*_*kbx的帖子

用链接更改PHP GET?

我想创建一个更改PHP $_GET变量的链接.例如:

URL: http://site.com/index&variable=hello&anothervariable=dontchangeme

<a href="variable=world">Click me</a>

(after click)

URL: http://site.com/index&variable=world&anothervariable=dontchangeme
Run Code Online (Sandbox Code Playgroud)

我知道你可以这样做只是改变页面(href="1.html"),但我想在保持已经存在的GET变量的同时做同样的事情.

php

1
推荐指数
1
解决办法
137
查看次数

将文件加载到字符串,没有这样的文件?

我正在制作一个python脚本来彻底破坏图像,为此,我用文件的文本中的每个"g"替换为"h"(现在,它可能会改变).这是开始,它不起作用:

pathToFile = raw_input('File to corrupt (drag the file here): ')

x = open(pathToFile, 'r')
print x
Run Code Online (Sandbox Code Playgroud)

给出路径(将文件拖入终端)后,结果如下:

File to corrupt (drag the file here): /Users/me/Desktop/file.jpeg 
Traceback (most recent call last):
  File "/Users/me/Desktop/corrupt.py", line 7, in <module>
    x = open(pathToFile, 'r')
IOError: [Errno 2] No such file or directory: '/Users/me/Desktop/file.jpeg '
Run Code Online (Sandbox Code Playgroud)

如果它就在那里,文件怎么可能不存在,而我正在使用确切的文件名?

python

0
推荐指数
1
解决办法
150
查看次数

os.path.dirname(__ file__)不存在?

可能重复:
os.path.dirname(__ file__)返回空

我的Python脚本的用户说他们得到以下错误:

Traceback (most recent call last):
File "MCManager.py", line 7, in <module>
os.chdir(os.path.dirname(__file__))
OSError: [Errno 2] No such file or directory: ''
Run Code Online (Sandbox Code Playgroud)

脚本所在的目录怎么可能不存在?这是兼容性问题吗?我使用与错误相同的操作系统和版本,并且无法复制此操作.

python runtime-error

0
推荐指数
1
解决办法
3677
查看次数

具有特定属性的标记的CSS?

我想用CSS设置一个表单.我#email input {}用来改变输入的外观.但是,我希望提交按钮的风格略有不同.我该怎么做这样的事情:

#email input {
    width: 614px;
    height: 30px;
    color: #000000;
    background: #FFFFFF;
    border: 1px solid #CCCCCC;
    margin: 5px;
    font-size: 26px;
    padding-left: 3px;
    padding-right: 3px;
}
#email input:type:submit {
    width: 620px;
    height: 30px;
    color: #000000;
    background: #FFFFFF;
    border: 1px solid #CCCCCC;
    margin: 5px;
    font-size: 26px;
    padding-left: 3px;
    padding-right: 3px;
}
Run Code Online (Sandbox Code Playgroud)

css

0
推荐指数
1
解决办法
174
查看次数

三个单词的正则表达式不起作用?

我需要一个包含三个单词的正则表达式,用空格分隔。我试过这个:

>>>match = re.search('\w\s\w\s\w', 'cat dog mouse')
>>>match.group()
....
AttributeError: 'NoneType' object has no attribute 'group'
Run Code Online (Sandbox Code Playgroud)

不应该\w\s\w\s\w接受“字字字”吗?

regex

0
推荐指数
1
解决办法
60
查看次数

将dict转换为键列表?

有没有办法在Python中生成dict中的键列表?例如:

>>>someDict = {'One': 1, 'Two': 2, 'Three': 3}
>>>someList = someDict.keys()
>>>print someList
['One', 'Two', 'Three']
Run Code Online (Sandbox Code Playgroud)

python

0
推荐指数
1
解决办法
460
查看次数

将列表转换为字符串?

为了使用random.choice(),我必须将我的字符串转换为列表:

>>> x = "hello"
>>> y = list(x)
>>> y
['h', 'e', 'l', 'l', 'o']
Run Code Online (Sandbox Code Playgroud)

但试图反过来产生一个实际上看起来像['h', 'e', 'l', 'l', 'o']而不仅仅是的字符串hello.重复这样做会导致无限循环,产生如下所示的字符串:

"'", '"', ',', ' ', "'", ',', "'", ',', ' ', "'", ' ', "'", ',', ' ', "'", '"', "'", ',', ' ', '"', "'", '"', ',', ' ', "'", '"', "'", ',', ' ', "'", ',', "'", ',', ' ', "'", ' ', "'", ',', ' ', '"', "'", '"', ',', …
Run Code Online (Sandbox Code Playgroud)

python

0
推荐指数
2
解决办法
329
查看次数

使用python进行Web数据库处理?

有没有办法在加载HTML页面时运行python脚本,在页面上放置变量并根据<input>s 设置python变量?我已经知道python,并且不想为此学习另一种语言.

python

-2
推荐指数
1
解决办法
77
查看次数

HTML标题的正则表达式?

我正在尝试使用正则表达式为其标题抓取HTML页面.这是我正在尝试的:

\<title\>\A\Z\</title\>
Run Code Online (Sandbox Code Playgroud)

有什么建议?

html regex

-3
推荐指数
1
解决办法
8322
查看次数

标签 统计

python ×5

regex ×2

css ×1

html ×1

php ×1

runtime-error ×1