易截截图软件、单文件、免安装、纯绿色、仅160KB

Python 中如何写if

python

content=str.find('ok')  &&  content=str.find('not ok')

这样表示 在内容中找到 ok  或者 找到 not ok 对吗?
并列条件用 and 而不是&&
或者条件用 or 而不是||

你的意思应该是or 你是都错了

找本教程看看吧,可以google搜索python


content=str.find('ok' or 'not ok')


可以这样写吗? 

下面有一句是

if content <> -1:
    .............


那我上面的 content=str.find('ok' or 'not ok')  对吗?

引用
找本教程看看吧,可以google搜索python


只能上CSDN  查不了 下不了

http://search.download.csdn.net/search/python

可以  be more pythonic way

>>> s = 'is it ok for ya?'
>>> if 'ok' in s:
...    print 'affirmative'
...
affirmative
>>>




相关问答:

[提问]Python 如何忽略 whitespace 读入

像 C 的 scanf() 那样
比如读入 1 2 3 a b c
每次读入一个
下面这个应该是你想要的吧:
Python code:

>>> k = raw_input()
0 0123 ds dsl sd
>>> k
'0 0123 ds dsl sd'
>>> ......

python list中添加类对象的问题

在list中添加一个类的局部变量 这样做是否合法 请看下面例子:
Python code:

class A():
def __init__( self ):
self.__a = 0
self.__b = 'hello'
def get_a( self ):
ret ......

python urllib urllib2 httplib 访问url的问题

我想用python解析网页中的url 在下载之前, 我想先发一个head请求 不需要下载整个网页, 先获得该网站的head信息, 读取一些信息之后 在调用这些库的read方法来读取整个网页 该怎么操作呢 多谢
帮顶了

有人能指教一 ......

各位大侠,Python 编码问题

例子是这样的:

>>> str1 = '小狗'
>>> str1
'小狗'
>>> str1.encode('utf-8')
b'\xe5\xb0\x8f\xe7\x8b\x97'
>>> str2 ......

【求助】python传系统参数无法传入,急!

我在批处理中调用python脚本
如下:
call %pyscript%\StaticResult.py -s D:\DailySDV\Bts8.1\TestLog\TestResult.xml -d %CiRoot_WndPath%\cruisecontrol\userData\groups\group01\projects\%ProjectName%\%GtrRl ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号