Skip to content

Commit 772e53d

Browse files
updated book details
1 parent d451f31 commit 772e53d

7 files changed

Lines changed: 72 additions & 7 deletions

File tree

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,19 @@ See [Version_changes.md](./Version_changes.md) to keep track of changes made to
2020

2121
# E-book
2222

23-
TODO: PDF/EPUB versions and sample chapters
23+
You can purchase the book using these links:
24+
25+
* https://leanpub.com/py_projects
26+
* https://learnbyexample.gumroad.com/l/py_projects
27+
28+
You can also get the book as part of **Learn by example Python bundle**:
29+
30+
* https://leanpub.com/b/python-bundle
31+
* https://learnbyexample.gumroad.com/l/python-bundle
32+
33+
See https://learnbyexample.github.io/books/ for list of other books
34+
35+
For a preview of the book, see [sample chapters](https://github.com/learnbyexample/practice_python_projects/blob/main/sample_chapters/practice_python_projects_sample.pdf)
2436

2537
The book can also be [viewed as a single markdown file in this repo](./practice_python_projects.md). See my blogpost on [generating pdf/epub from markdown using pandoc](https://learnbyexample.github.io/customizing-pandoc/) if you are interested in the ebook creation process.
2638

practice_python_projects.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ If you are new to programming or Python, I'd highly recommend my [comprehensive
3030
* Code snippets that are copy pasted from the Python REPL shell have been modified for presentation purposes. For example, comments to provide context and explanations, blank lines to improve readability and so on.
3131
* A comment with filename will be shown as the first line for program files.
3232
* External links are provided for further exploration throughout the book. They have been chosen with care to provide more detailed resources on those topics as well as resources on related topics.
33-
* The [practice_python_projects repo](https://github.com/learnbyexample/practice_python_projects/tree/main/programs) has all the programs presented in this book, organized by project for convenience.
33+
* The [practice_python_projects repo](https://github.com/learnbyexample/practice_python_projects/tree/main/programs) has all the programs and related example files presented in this book, organized by project for convenience.
3434

3535
## Acknowledgements
3636

@@ -631,7 +631,7 @@ Modify the scripts such that these additional features are also implemented.
631631

632632
* Go through [docs.python: ArgumentParser](https://docs.python.org/3/library/argparse.html#argparse.ArgumentParser) and experiment with parameters like `description`, `epilog`, etc.
633633

634-
### Further Reading
634+
## Further Reading
635635

636636
Python has a rich ecosystem in addition to the impressive standard library. You can find plenty of modules to choose for common tasks, including alternatives for standard modules. Check out these projects for CLI related applications.
637637

@@ -1118,7 +1118,7 @@ Here's the result for **2021** poll:
11181118
* You'll have to fuzzy match the author names since the spelling that won could be different between the two lists.
11191119
* Find out top-5 authors who had at least **5** votes in both the lists and had the biggest gain in 2021 compared to the 2019 data. You can decide how to calculate the gain — vote count or percentage increase.
11201120
1121-
### Further Reading
1121+
## Further Reading
11221122
11231123
* `praw`
11241124
* [praw.readthedocs.io](https://praw.readthedocs.io/en/latest/)
@@ -1509,7 +1509,7 @@ You can also speed up creating these extra files by filtering words with a minim
15091509
* You can also use packages like [Gooey](https://github.com/chriskiehl/Gooey) to create a GUI from this CLI program.
15101510
* Change the `typos.py` program so that it works for both plain text and Markdown input files based on filename extensions.
15111511
1512-
### Further Reading
1512+
## Further Reading
15131513
15141514
* Spell checkers and related:
15151515
* [wikipedia: Spell checker](https://en.wikipedia.org/wiki/Spell_checker)
@@ -2091,7 +2091,7 @@ Here's some screenshots:
20912091
* Read this [tkdocs: Checkbutton](https://tkdocs.com/tutorial/widgets.html#checkbutton) tutorial and implement a solution for cases requiring multiple choices to be selected for a given question.
20922092
* Implement `mcq_gui.py` without using classes if you are still not convinced that OOP is better for GUI applications.
20932093
2094-
### Further Reading
2094+
## Further Reading
20952095
20962096
* [tkdocs](https://tkdocs.com/index.html) — tutorials, best practices and more
20972097
* [wiki.python: TkInter](https://wiki.python.org/moin/TkInter) — learning resources, extensions, etc
@@ -2996,7 +2996,7 @@ Earlier, you saw one example of AI choosing the next move to be made. Here's the
29962996
* Read [PEP 8: Style Guide for Python Code](https://www.python.org/dev/peps/pep-0008/).
29972997
* Use [pylint](https://pypi.org/project/pylint/) and/or [black](https://pypi.org/project/black/) to detect code smells, formatting inconsistencies, etc for these projects.
29982998
2999-
### Further Reading
2999+
## Further Reading
30003000
30013001
* [Pygame learning resources](https://www.pygame.org/wiki/resources) — better suited package for creating games
30023002
* [List of Game Development resources](https://github.com/ellisonleao/magictools)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Lookarounds
2+
3+
In this chapter you'll learn more groupins, known as lookarounds, that
4+
help to create custom anchors and add conditions within RE definition.
5+
6+
## Negative lookarounds
7+
8+
* `(?!pat)` — negative lookahead assertion
9+
* `(?<!pat)` — negative lookbehind assertion
10+
11+
```ruby
12+
>>> re.sub(r'foo(?!\d)', 'baz', 'hey food! foo42 foot5 foofoo')
13+
'hey bazd! foo42 bazt5 bazbaz'
14+
15+
>>> re.sub(r'(?<!_)foo', 'baz', 'foo _foo 42foofoo')
16+
'baz _foo 42bazbaz'
17+
```
18+
19+
## Positive lookarounds
20+
21+
* `(?=pat)` — positive lookahead assertion
22+
* `(?<=pat)` — positive lookbehind assertion
23+
24+
```ruby
25+
>>> re.findall(r'(?<=-)\d+(?=[:;])', '42 foo-5, baz3; x-83, y-20: f12')
26+
['20']
27+
28+
>>> re.sub(r'par(?=.*\bpart\b)', 'X', 'par spare part party')
29+
'X sXe part party'
30+
```
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# re introduction
2+
3+
In this chapter, you'll get an introduction of `re` module
4+
that is part of Python's standard library.
5+
6+
## re.search
7+
8+
Use `re.search` function to tesr if the the given regexp pattern
9+
matches the input string. Syntax is shown below:
10+
11+
>`re.search(pattern, string, flags=0)`
12+
13+
```python
14+
>>> sentence = 'This is a sample string'
15+
>>> bool(re.search(r'is.*am', sentence))
16+
True
17+
>>> bool(re.search(r'str$', sentence))
18+
False
19+
```
20+
21+
[My book](https://github.com/learnbyexample/py_regular_expressions)
22+
on Python regexp has more details.
23+
1.13 KB
Loading
780 Bytes
Loading
353 KB
Binary file not shown.

0 commit comments

Comments
 (0)