|
|
|
|
 大家好!一个很简单的替换问题,请告诉我,在线上等 - xiefengming [ 2005-02-17 10:07 | 318 byte(s)]
 Re: 大家好!一个很简单的替换问题,请告诉我,在线上等 - limodou [ 2005-02-17 10:25 | 167 byte(s)]
 Re: 大家好!一个很简单的替换问题,请告诉我,在线上等 - xiefengming [ 2005-02-17 10:50 | 150 byte(s)]
 Re: 大家好!一个很简单的替换问题,请告诉我,在线上等 - xiefengming [ 2005-02-17 10:47 | 311 byte(s)]
 Re: 大家好!一个很简单的替换问题,请告诉我,在线上等 - limodou [ 2005-02-17 10:50 | 292 byte(s)]
 Re: 大家好!一个很简单的替换问题,请告诉我,在线上等 - xiefengming [ 2005-02-17 11:17 | 675 byte(s)]
 Re: 大家好!一个很简单的替换问题,请告诉我,在线上等 - limodou [ 2005-02-17 12:34 | 142 byte(s)]
 Re: 大家好!一个很简单的替换问题,请告诉我,在线上等 - limodou [ 2005-02-17 10:15 | 96 byte(s)]
 Re: 大家好!一个很简单的替换问题,请告诉我,在线上等 - xiefengming [ 2005-02-17 10:20 | 61 byte(s)]
|
|
|
|
[Original]
[Print]
[Top]
|
我要将“c: ext”中的""替换成"\"
>>> a = 'c: ext'
>>> b = a.replace('\','/')
>>> b
'c: ext'
没有成功,下面这样也不行。
b = a.replace('\','\')
请告诉我解决的方法,谢谢!!!
|
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
如果在字符串中的不是转义字符,那么不正确是因为你的替换串只写了三个,应该是
b=a.replace('\', '\\')
使用r还可以简化为:
b=a.replace(r'', r'\')
|
|
|
----
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
>>> a = 'c: ext'
>>> b = a.replace(r'',r'\')
Traceback ( File "<interactive input>", line 1
b = a.replace(r'',r'\')
^
SyntaxError: invalid token
还是不行啊?
|
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
已经和你说了,你的a='c: ext'是有问题的。
python会吧 联在一起认为是转义字符,就是tab符。
因此先要写正确:
c=r'c: ext'或c='c:\text'才可以。
如果你从python的api来的,应该得到的都是象:
'c:\text'这种形式的,不会出现你的问题。如果是自已测试就要写正确。
|
|
|
----
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
我HTML表单值是
D:ceshi4_3_ Extracting data from HTML documents.filesdiveintopython.css
提交:
<form name="form1" method="post" action="loadfile_pythonftp" enctype="MULTIPART/FORM-DATA" id=form1_id>
返回:
from Products.PythonScripts.standard import html_quote
request = container.REQUEST
RESPONSE = request.RESPONSE
file = request['file_affix_path']
return file
得到的结果是:
<ZPublisher.HTTPRequest.FileUpload instance at 0x01AC5418>
这是什么问题,我为什么得不到表单的值,请赐教!谢谢!
|
|
|
[Original]
[Print]
[Top]
|
|
|