xianhu / learnpython Goto Github PK
View Code? Open in Web Editor NEW以撸代码的形式学习Python
Home Page: https://github.com/xianhu/LearnPython
以撸代码的形式学习Python
Home Page: https://github.com/xianhu/LearnPython
请问你用的什么环境?我用的是Python2.7,在运行过程中报错:
2016-11-09 21:57:24,653 INFO Starting new HTTP connection (1): 127.0.0.1
2016-11-09 21:57:27,233 DEBUG "GET http://weibo.com/login.php HTTP/1.1" 200 None
2016-11-09 21:57:31,757 INFO Resetting dropped connection: 127.0.0.1
2016-11-09 21:57:31,871 DEBUG "GET http://login.sina.com.cn/sso/prelogin.php?checkpin=1&su=&callback=sinaSSOController.preloginCallBack&rsakt=mod&client=ssologin.js%28v1.4.18%29&entry=weibo&_=1478699847240 HTTP/1.1" 200 None
2016-11-09 21:57:31,872 DEBUG WeiBoLogin get_json_data: {u'nonce': u'RHMSEX', u'rsakv': u'1330428213', u'retcode': 0, u'exectime': 9, u'servertime': 1478699850, u'pcid': u'gz-789fcba1ca6723b1b64d880551d5c5b0081e', u'pubkey': u'EB2A38568661887FA180BDDB5CABD5F21C7BFD59C090CB2D245A87AC253062882729293E5506350508E7F9AA3BB77F4333231490F915F6D63C55FE2F08A49B353F444AD3993CACC02DB784ABBB8E42A9B1BBFFFB38BE18D78E87A0E41B9B8F73A928EE0CCEE1F6739884B9777E4FE9E88A1BBE495927AC4A799B3181D6442443'}
2016-11-09 21:57:36,384 INFO Resetting dropped connection: 127.0.0.1
2016-11-09 21:57:36,696 DEBUG "POST http://login.sina.com.cn/sso/login.php?client=ssologin.js(v1.4.18)&_=1478699851 HTTP/1.1" 200 None
Traceback (most recent call last):
File "C:/Users/zheng/PycharmProjects/spider/weibo.py", line 159, in
weibo.login()
File "C:/Users/zheng/PycharmProjects/spider/weibo.py", line 92, in login
json_data_1 = self.session.post(login_url_1, data=post_data).json()
File "C:\Python27\lib\requests\models.py", line 826, in json
return complexjson.loads(self.text, **kwargs)
File "C:\Python27\lib\json_init_.py", line 339, in loads
return _default_decoder.decode(s)
File "C:\Python27\lib\json\decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Python27\lib\json\decoder.py", line 382, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
解释器版本: 3.6.4
a = ([1,2])
a[0][1] = 0
报错
元组不写逗号, 默认是一个变量, 不能通过索引得到
正确写法:
a = ([1,2], )
a[0][1] = 0
x[i], x[i:j:k] #索引,分片、调用
python_base.py
set是可变对象,即不存在hash值,不能作为字典的键值。同样的还有list、tuple等 frozenset是不可变对象,即存在hash值,可作为字典的键值 frozenset对象没有add、remove等方法,但有union/intersection/difference等方法
tuple 是不可变对象,这里是笔误么?
我在python2.7里找不到parse的module
Maybe using pandas as csv tutorial will be better?
可不可以请大神把这行代码翻译成普通def形式。主要是不清楚lambda z, c, n: a(a, z, c, n)这一行返回的是什么。
您好。请问python_lda.py里需要的corpus.txt文件在哪里可以获得?
Hi
Thanks for using dash-bootstrap-components! I just wanted to let you know that we made a breaking change to the Navbar
component, so if you update to version 0.3.0
or later of dash-bootstrap-components you might get unexpected behaviour.
You can use the new NavbarSimple
component exactly as you are currently using Navbar
currently, so the easiest fix would be to just change Navbar
to NavbarSimple
.
Check out the docs for Navbar
and our examples for more details.
file:python_base.py
lineno:83
t = set("Hello") # 创建一个唯一字符的集合返回{}
set("Hello")
返回:{'l', 'H', 'e', 'o'}
As Title.
https://zhuanlan.zhihu.com/p/31323002
您好,首先十分感谢您的教程
其次,我按照您的demo运行过了,但是还是不能生成动态图(即图片并没有随着代码和数据点的变化而变化)而是一张静态的图片
我使用的是matplotlib2.02,pycharm,windows 系统,我不知道什么原因,可以请教一下您吗
最好有详细的注解。
import pandas as pd
It should import a module
python_base.py
L524
# Keyword-Only参数:出现在*args之后 必须用关键字进行匹配
def keyOnly(a, *b, c): print('') # c就为keyword-only匹配 必须使用关键字c = value匹配
def keyOnly(a, *, b, c): ...... # b c为keyword-only匹配 必须使用关键字匹配
def keyOnly(a, *, b = 1): ...... # b有默认值 或者省略 或者使用关键字参数b = value
def keyOnly(a, *b, c)
是不是应该是 def keyOnly(a, c, *b)
?
def keyOnly(a, *, b, c)
这边的*
怎么理解?
Line 664 in 491e324
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.