Python代码片段 [英] Python Code Snippets

查看:81
本文介绍了Python代码片段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




有谁知道我在哪里可以找到很多Python代码片段?


我搜索了Python维基和互联网但是一次找不到超过五个或者一两个代码片段。


我正在寻找一种有组织的列表(GUI片段,数据库访问

片段,I / O片段等)。我发现学习

语言没有比能够剪切和粘贴实际工作位代码更好的方法了。


谢谢,
$ b $bAurélien

Hi,

Does anyone know where I can find a lot of Python code snippets?

I searched the Python wiki and Internet but could not find more than five or
ten code snippets at a time.

I''m looking for a kind of organized list (GUI snippets, database access
snippets, I/O snippets, etc.). I find that there''s no better way to learn a
language than to be able to cut&paste actual working bits of code.

Thanks,
Aurélien

推荐答案

你会喜欢这个:)

http://aspn.activestate.com/ASPN/Cookbook/Python

"AurélienGéron" < AG **** @ HOHOHOHOvideotron.ca>在消息中写道

新闻:是*********** @ biggoron.nerim.net ...
You''re gonna love this :)

http://aspn.activestate.com/ASPN/Cookbook/Python
"Aurélien Géron" <ag****@HOHOHOHOvideotron.ca> wrote in message
news:be***********@biggoron.nerim.net...


我搜索了Python维基和互联网,但一次找不到超过5个
或10个代码片段。

我正在寻找一种有组织的列表(GUI片段,数据库访问片段,I / O片段等)。我发现没有更好的方法来学习
a语言而不是能够剪切和粘贴实际工作的代码。

谢谢,
Aurélien
Hi,

Does anyone know where I can find a lot of Python code snippets?

I searched the Python wiki and Internet but could not find more than five or ten code snippets at a time.

I''m looking for a kind of organized list (GUI snippets, database access
snippets, I/O snippets, etc.). I find that there''s no better way to learn a language than to be able to cut&paste actual working bits of code.

Thanks,
Aurélien



GuyonMorée写道:
Guyon Morée wrote:
你会喜欢这个:)

http://aspn.activestate.com/ASPN/Cookbook/Python

"AurélienGéron" < AG **** @ HOHOHOHOvideotron.ca>在消息中写道
新闻:是*********** @ biggoron.nerim.net ...
You''re gonna love this :)

http://aspn.activestate.com/ASPN/Cookbook/Python
"Aurélien Géron" <ag****@HOHOHOHOvideotron.ca> wrote in message
news:be***********@biggoron.nerim.net...

Hi,

Does anyone know where I can find a lot of Python code snippets?



或者您可能只想环顾四周。在这个

新闻组/邮件列表中,人们可以看到很多不错的代码。


我会提名一个最好的测量硬件的测试-core

python程序员将在没有

上下文的情况下解释下面的代码:)


Karl Scalet写道:有很可能更简单的方法,但至少

s =''C6 H12 O6''
打印[''''.join(xx)for xx in apply(
zip ,[(x [0],x [1:])for s in s.split()])]

给出一些结果,

Karl


Or you might want to just look around here. In this
newsgroup/mailing-list one gets to see really lots of nice code.

One that I would nominate as the best test for measuring a hard-core
python programmer would be to explain the following code without the
context :)

Karl Scalet wrote: there are very likely easier ways, but at least

s = ''C6 H12 O6''
print ['' ''.join(xx) for xx in apply(
zip,[(x[0],x[1:]) for x in s.split()])]

gives some results,

Karl




一旦我理解了上述内容,我相信我会在简历中编写python ...


这是什么意思一个简单的明显的做法? ;)



Once I understood the above, I beleive I will write python in my Resume...

What was this about "One simple obvious way doing it"? ;)


嘿谢谢!

我希望它有一个比列表更好的排序,但它已经满了好的

的东西。

$ b $bAurélien


"GuyonMorée" <顾*** @ looze.net>一个écritdansle message de

新闻:3f ********************** @ news.nl.uu.net ...
Hey thanks !
I wish it had a better ordering than just a list, but it''s full of good
stuff.

Aurélien

"Guyon Morée" <gu***@looze.net> a écrit dans le message de
news:3f**********************@news.nl.uu.net...
你会喜欢这个:)

http://aspn.activestate.com/ASPN/Cookbook/Python

"AurélienGéron" < AG **** @ HOHOHOHOvideotron.ca>在消息中写道
新闻:是*********** @ biggoron.nerim.net ...
You''re gonna love this :)

http://aspn.activestate.com/ASPN/Cookbook/Python
"Aurélien Géron" <ag****@HOHOHOHOvideotron.ca> wrote in message
news:be***********@biggoron.nerim.net...


有没有人知道我在哪里可以找到很多Python代码片段吗?

我在Python维基和互联网上搜索但找不到
Hi,

Does anyone know where I can find a lot of Python code snippets?

I searched the Python wiki and Internet but could not find more than


五或

一次十个代码片段。

我正在寻找一种有组织的列表(GUI片段,数据库访问片段,I / O片段等)。我发现没有更好的方法来
ten code snippets at a time.

I''m looking for a kind of organized list (GUI snippets, database access
snippets, I/O snippets, etc.). I find that there''s no better way to


学习

语言,而不是能够剪切和粘贴代码的实际工作位。

谢谢,
Aurélien
language than to be able to cut&paste actual working bits of code.

Thanks,
Aurélien




这篇关于Python代码片段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆