Synopsis: import portalocker file = open("somefile", "r+") portalocker.lock(file, portalocker.LOCK_EX) file.seek(12) file.write("foo") file.close() 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 #!/usr/bin/env python2.4 # This program shows off a python decorator( # which implements tail call optimization. It # does this by throwing an exception if it is # it's own grandparent, and catching such # exceptions to recall th
Index of /~eppstein/PADS NameLast modifiedSizeDescription Parent Directory - ABOUT-PADS.txt2015-02-18 17:28 1.5K AcyclicReachability.py2014-05-25 11:54 1.5K Automata.py2014-05-25 11:54 21K BFS.py2012-05-09 15:57 859 Bicliques.py2017-09-22 21:54 3.0K Biconnectivity.py2014-05-25 11:54 8.8K Bipartite.py2012-05-08 16:19 2.2K BipartiteMatching.py2012-05-09 15:57 4.3K BucketQueue.py2016-07-03 15:44 2.8
これはなんですか? 奥村晴彦氏の著書「C言語による最新アルゴリズム事典」をPythonでやろうと決意。Rubyに翻訳されていたので、Pythonでもやってみようと。でも実は書籍はもっていなくてCとRubyのソースを見つつ翻訳しています。1日1個ペースで進んでいます。 やっているうちにこの本が欲しくなってきました。 個人のPython力を高めるために始めましたので、間違いが含まれているかもしれません。ご指摘等ございましたら連絡[syobosyobo at gmail dot com]ください。 ちょっと方針をかえて、ctopyで訳すことにした。またまた方針をかえて、、、ctopyはあまりつかえない。ちょっといじってやらないと、出力がよくない。コメントとか入ってると、うまく変換してくれないし。 で、そのあとPythonらしい書き方で書いていこう、かと。どうなるかわかりませんが。
Python 3 Patterns & Idioms This is an intermediate-to-advanced level book focusing on Python 3 features, idioms and patterns. The book is created using an open-source development process, and is published under a Creative Commons Attribution-Share Alike 3.0 license. Please Note: This book is in early development, so expect to find many incorrect and incomplete portions. The latest version o
SQLAlchemy is the Python SQL toolkit and Object Relational Mapper that gives application developers the full power and flexibility of SQL. SQLAlchemy provides a full suite of well known enterprise-level persistence patterns, designed for efficient and high-performing database access, adapted into a simple and Pythonic domain language. Major SQLAlchemy features include: An industrial strength ORM,
Python Scripting for Computational Science (Texts in Computational Science and Engineering)をテキストにして、科学技術関連の計算や処理にPythonを活用する方法を学んでいる。この本の中で計算やグラフ作成、3D描画等に有用なモジュールが紹介されていたのでどういうものがあるか一通り見てみた。 今後使えそうなものも多くあるので、ここにまとめておく。 Biggles(http://biggles.sourceforge.net/):GNU plotutilsをベースにしたプロットツール CAGE(http://www.alcyone.com/software/cage/):A generic and fairly complete cellular automata simulation engine.(よ
¶ Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed. By using non-blocking network I/O, Tornado can scale to tens of thousands of open connections, making it ideal for long polling, WebSockets, and other applications that require a long-lived connection to each user. Quick links¶ Current version: 6.4.1 (download from PyPI, release notes) Sour
Revision 2.12 Amit Patel Antoine Picard Eugene Jhong Jeremy Hylton Matt Smart Mike Shields Each style point has a summary for which additional information is available by toggling the accompanying arrow button that looks this way: ▶. You may toggle all summaries with the big arrow button: Overview Important Note Displaying Hidden Details in this Guide ▶ This style guide contains many details
Hiho to my first python tutorial. Julian Krause aka thecrypto aka Mr. RhubarbTart mentioned the eigenclass article Plugins in your Ruby Application and noticed that there is no such tutorial for python. So: here it is ;-) Since version 2.2 python ships a new object model (explained in the documentation) which allows very complex class definitions including metaclasses and other features you probab
Quick development solutions have become a vital part of developing enterprise-grade applications in recent years. Businesses are looking for rapid application development for digital transformation. These software development approach have replaced traditional development to create apps for business process management and promote the idea of "Citizen Developers." Moreover, these development tools
These pages are supplied by users in the School of Computer Science & Informatics. The information in these pages is presented at the discretion of the user concerned. Some pages are experimental, some are recreational. Students doing Internet courses may also have Project pages visible within the School only. Staff Sites
Georg found a way today to get the names for a variable in Python. Motivated by this incredible hack I gave porting runkit_return_value_used from PHP to Python a try. What this function does in PHP is finding out if the return value of a function is used or not. So if you're evil you could write a function like this in PHP: <?php function the_today() { $today = date("l jS \\of F Y h:i:s A"); if (r
Zine is a personal publishing platform a.k.a. weblog engine written in Python. It's Open Source, free and developed with a focus on security and usability. The current Zine release is 0.1 and was released on December the 24th, 2008. Get Zine 0.1 Latest release, 1.2MB Looking for Help? Join the #pocoo IRC Channel on irc.freenode.net.
I spent some time digging around in the Python code to understand how .pyc files work. It turns out they are fairly simple, then kind of complex. At the simple level, a .pyc file is a binary file containing only three things: A four-byte magic number,A four-byte modification timestamp, andA marshalled code object.The magic number is nothing as cool as cafebabe, it’s simply two bytes that change wi
Pythonにはじめて触って、いつのまにか1年が過ぎたのですが、一番はまったのは、やっぱりunicodeの扱いだったと思います。 特に、 UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-12: ordinal not in range(128) のようなエラーにはさんざん悩まされました。ここがたとえばrubyなど他の言語と比べてわかりにくいために、Pythonが取っつきにくい言語になっているのではないか、と個人的には思います。 そこで、このエラーに関係するはまりどころとTipsをいくつか列挙してみました。これからPythonに触れられる方の参考になればと思います。 なお、環境はUNIX上のPython 2.4, 2.5を想定しています。 u1はunicode型で、s1はstr型です。s1にどのよ
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く