PythoFF

Menu

Sign in:

read us on

Использование API HTMS для работы с реляционно-сетевой базой данных

Введение В статье «Реляционно-сетевая модель данных» была предложена новая концепция моделирования данных HTMS, являющаяся развитием канонической реляционной модели. В настоящем материале будет показано на примерах, как ее можно практически использовать с применением API логического уровня. Примеры привязаны к широко известному учебно-методическому решению по созданию сайтов — шаблону веб-проекта опросов на фреймворке Django в MS Visual Studio. Для понимания статьи требуется знание основ языка Python и фреймворка Django.

home/2019/11/09/46bcc65a743db06c0a54af10109a30c33ff5253f.jpg

Windows 10 + Python = VS Code + WSL

Microsoft… Технологических локомотивов нашего времени. Ни для кого не секрет что они крутые, а также, что они поглощают все больше и больше… Всего. К счастью последнее время они только радуют меня своим потенциалом. А после выступления Satya Nadella, где он рассказал миру о том, что Windows больше не является основным продуктом компании, так как они положили курс на внедрение своих API…. Повсюду… Для разработчиков ПО они так же не скупятся. C#, Azure, Visual Studio… Но сейчас пойдет речь о Python, ведь для него местечко здесь тоже пригрели. Кратко о WSL С обновлением Windows появилась возможность использовать такую штуку, как WSL (Windows Subsystem for Linux). Не так давно появилась WSL2 с ОЧЕНЬ крутыми доработками. WSL2 использует новейшую и самую новую технологию виртуализации для запуска ядра Linux внутри упрощенной служебной виртуальной машины. Это значит, что такие атрибуты, как изоляция и замедление работы здесь отсутствуют.

home/2019/11/09/7acc6590bf5cfa8674df86272a4782cbfc0d9524.jpg

Плюсы и минусы Django

Прим. перев.: Эта статья рассчитана в основном на тех кто только выбирает фреймворк для веб-разработки. Опытные разработчики на Django вряд ли узнают что-то новое. Django описывают как «веб-фреймворк для перфекционистов с дедлайнами». Его создали, чтобы переходить от прототипов к готовым сервисам как можно быстрее. Фреймворк поможет разработать CRUD приложение под ключ. С Django не придется изобретать велосипед. Он работает из коробки и позволит сосредоточиться на бизнес-логике и продуктах для обычных людей. Плюсы Джанго Принцип «Всё включено» («Batteries included») Фраза «всё включено» означает, что большинство инструментов для создания приложения — часть фреймворка, а не поставляются в виде отдельных библиотек. Django содержит огромное количество функциональности для решения большинства задач веб-разработки. Вот некоторые из высокоуровневых возможностей Django, которые вам придётся искать отдельно, если вы предпочтёте микро-фреймворк: ORM Миграции базы данных Аутентификация пользователя Панель администратора Формы

home/2019/11/09/557eaef3ebd632b1f6d3504326b06016ff687c16.jpg

When to Use a List Comprehension in Python

Python list comprehensions make it easy to create lists while performing sophisticated filtering, mapping, and conditional logic on their members. In this tutorial, you'll learn when to use a list comprehension in Python and how to create them effectively.

PyDev of the Week: Joannah Nanjekye

This week we welcome Joannah Nanjekye (@Captain_Joannah) as our PyDev of the Week! Joannah is a core developer of the Python programming language. She is also the author of Python 2 and 3 Compatibility. You can find out more about Joannah on here website. Let’s take a few moments to get to know her better! Can you tell us a little about yourself (hobbies, education, etc): I am Joannah Nanjekye, I live in Canada, Fredericton but I am originally from Uganda in East Africa. I am a CS grad and doing research related to Python in one of the Python IBM labs at UNB. I went to University in Uganda and Kenya where I studied Software Engineering at Makerere University and Aeronautical Engineering at Kenya Aeronautical College respectively. I am also the Author of Python 2 and 3 compatibility, a book published by Apress. I do not have any serious hobbies but I love flying aircraft. Very expensive hobby heh!! Continue reading PyDev of the Week: Joannah Nanjekye →

The Demos for PySimpleGUI

The PySimpleGUI project has a lot of interesting demos included with their project that you can use to learn how to use PySimpleGUI. The demos cover all the basic widgets as far as I can tell and they also cover the recommended design patterns for the package. In addition, there are a couple of games and other tiny applications too, such as a version of Pong and the Snake game. In this article, you will see a small sampling of the demos from the project that will give you some idea of what you can do with PySimpleGUI. Seeing the Available Widgets PySimpleGUI has a nice little demo called Demo_All_Widgets.py that demonstrates almost all the widgets that PySimpleGUI supports currently. PySimpleGUI has wrapped all of Tkinter’s core widgets, but not the ttk widgets. This is what the demo looks like when you run it: Let’s take a quick look at the code for this demo: #!/usr/bin/env python ''' Example of (almost) all widgets, that you can use in PySimpleGUI. '''   import PySimpleGUI as sg   sg.change_look_and_feel('GreenTan')   # ------ Menu Definition ------ # menu_def = [['&File', ['&Open', '&Save', 'E&xit', 'Properties']], ['&Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ], ['&Help', '&About...'], ]   # ------ Column Definition ------ # column1 = [[sg.Text('Column 1', background_color='lightblue', justification='center', size=(10, 1))], [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]]   layout = [ [sg.Menu(menu_def, tearoff=True)], [sg.Text('(Almost) All widgets in one Window!', size=( 30, 1), justification='center', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE)], [sg.Text('Here is some text.... and a place to enter text')], [sg.InputText('This is my text')], [sg.Frame(layout=[ [sg.CBox('Checkbox', size=(10, 1)), sg.CBox('My second checkbox!', default=True)], [sg.Radio('My first Radio! ', "RADIO1", default=True, size=(10, 1)), sg.Radio('My second Radio!', "RADIO1")]], title='Options', title_color='red', relief=sg.RELIEF_SUNKEN, tooltip='Use these to set flags')], [sg.MLine(default_text='This is the default Text should you decide not to type anything', size=(35, 3)), sg.MLine(default_text='A second multi-line', size=(35, 3))], [sg.Combo(('Combobox 1', 'Combobox 2'), size=(20, 1)), sg.Slider(range=(1, 100), orientation='h', size=(34, 20), default_value=85)], [sg.OptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))], [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)), sg.Frame('Labelled Group', [[ sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25, tick_interval=25), sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75), sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), sg.Col(column1, background_color='lightblue')]]) ], [sg.Text('_' * 80)], [sg.Text('Choose A Folder', size=(35, 1))], [sg.Text('Your Folder', size=(15, 1), justification='right'), sg.InputText('Default Folder'), sg.FolderBrowse()], [sg.Submit(tooltip='Click to submit this form'), sg.Cancel()]]   window = sg.Window('Everything bagel', layout, default_element_size=(40, 1), grab_anywhere=False)   event, values = window.read() sg.popup('Title', 'The results of the window.', 'The button clicked was "{}"'.format(event), 'The values are', values) PySimpleGUI lays out their widgets by using Python lists. You can also see that this demo uses lists for generating the menus too. Then you create a Window object and pass in the layout, which is your list of lists of Elements or widgets. Let’s see what else you can do! Graphing with PySimpleGUI PySimpleGUI also supports creating graphs. One such example can be found in Demo_Graph_Element_Sine_Wave.py. This demo shows the developer how to use the Graph widget. This is what the demo looks like when you run it: Here is what the code looks like: import PySimpleGUI as sg import math   # Yet another usage of Graph element.   SIZE_X = 200 SIZE_Y = 100 NUMBER_MARKER_FREQUENCY = 25     def draw_axis(): graph.draw_line((-SIZE_X, 0), (SIZE_X, 0)) # axis lines graph.draw_line((0, -SIZE_Y), (0, SIZE_Y))   for x in range(-SIZE_X, SIZE_X+1, NUMBER_MARKER_FREQUENCY): graph.draw_line((x, -3), (x, 3)) # tick marks if x != 0: # numeric labels graph.draw_text(str(x), (x, -10), color='green')   for y in range(-SIZE_Y, SIZE_Y+1, NUMBER_MARKER_FREQUENCY): graph.draw_line((-3, y), (3, y)) if y != 0: graph.draw_text(str(y), (-10, y), color='blue')     # Create the graph that will be put into the window graph = sg.Graph(canvas_size=(400, 400), graph_bottom_left=(-(SIZE_X+5), -(SIZE_Y+5)), graph_top_right=(SIZE_X+5, SIZE_Y+5), background_color='white', key='graph') # Window layout layout = [[sg.Text('Example of Using Math with a Graph', justification='center', size=(50, 1), relief=sg.RELIEF_SUNKEN)], [graph], [sg.Text('y = sin(x / x2 * x1)', font='COURIER 18')], [sg.Text('x1'), sg.Slider((0, 200), orientation='h', enable_events=True, key='-SLIDER-')], [sg.Text('x2'), sg.Slider((1, 200), orientation='h', enable_events=True, key='-SLIDER2-')]]   window = sg.Window('Graph of Sine Function', layout)   while True: event, values = window.read() if event is None: break graph.erase() draw_axis() prev_x = prev_y = None   for x in range(-SIZE_X, SIZE_X): y = math.sin(x/int(values['-SLIDER2-']))*int(values['-SLIDER-']) if prev_x is not None: graph.draw_line((prev_x, prev_y), (x, y), color='red') prev_x, prev_y = x, y   window.close() To make the graph work correctly, you need to erase the graph and redraw it in the while loop above. Play around with the code a bit and see what you can do. There are several other graph related demos in the demo folder that you should check out as well. PySimpleGUI also supports matplotlib integration. A fun one to play around with is Demo_Matplotlib_Animated.py. When I ran it, the demo ended up looking like this: Now let’s check out another demo! Creating Pong with PySimpleGUI As I mentioned earlier in this article, you can also create the Pong game pretty easily using PySimpleGUI. You can check out Demo_Pong.py for full details. Here is what the code creates when you run it: The code for this game is a bit long, but not too hard to follow. At the time of writing, the game is written using 183 lines of code in a single module. Wrapping Up There are 150+ demos in PySimpleGUI’s Demo folder. I did discover a few that didn’t work on Linux due to using OS-specific code. However most of the examples seem to work and they are a great way to see what you can do with this project. Check them out to get some ideas of how you could use PySimpleGUI for your own projects or demos. Related Reading A Brief Intro to PySimpleGUI PySimpleGUI documentation Other simple PySimpleGUI applications

home/2019/10/30/37b50864a3c49d87b1786bad7821a3bb9eb11626.jpg

Python REST APIs With Flask, Connexion, and SQLAlchemy – Part 4

In Part 4 of this series, you'll learn how to create a Single-Page Application (SPA) to interface with the REST API backend that you built in Part 3. Your SPA will use HTML, CSS, and JavaScript to present this REST API to a user as a browser-based web application.

home/2019/10/29/78798d3c858be49cc50edb9c91763d824dcacf87.jpg

Python Type Checking

In this course, you'll look at Python type checking. Traditionally, types have been handled by the Python interpreter in a flexible but implicit way. Recent versions of Python allow you to specify explicit type hints that can be used by different tools to help you develop your code more efficiently.

home/2019/10/28/875d547e9ab11026fd121349a67255721c767ae5.jpg

Python Community Interview With Al Sweigart

Al Sweigart is an accomplished developer, conference speaker, teacher, and origamist. But some may know him best for his numerous Python programming books, such as Automate the Boring Stuff with Python.

PyDev of the Week: David Fischer

This week we welcome David Fischer (@djfische) as our PyDev of the Week! David is an organizer of the San Diego Python user’s group. He also works for Read the Docs. You can see what David has been up to on his website or check out what he’s been up to on Github. Let’s take a few moments to get to know David better! Can you tell us a little about yourself (hobbies, education, etc): I am one of the organizers of the San Diego Python meetup and I’ve been doing that since early 2012, but my hobbies nowadays mostly involve spending time with my 3 year old daughter. I also really enjoy games of all kinds from in-person board and card games to computer games and my daughter is just about the right age to start introducing this stuff. I have a bachelor’s degree in applied math and despite the name that involved a lot of programming. Mostly I learned Java in college which outside of some Android development I’ve barely used since. For work, I previously worked at Qualcomm, Amazon, and a beer-tech related startup (how San Diego!). I currently work on Read the Docs. I’ve had the opportunity to work on lots of different things from web apps, mobile apps, technical sales/marketing, scalability, security, and privacy. I don’t want to rule out working for big companies, but the small company life seems like a better fit for me. Perhaps this comes out of some of my security and privacy work, but I try not to participate much on social media. I was surprised to be contacted to do this interview because I think of myself as having a pretty low profile in the Python community outside of San Diego. I’m happy to do it, though. Continue reading PyDev of the Week: David Fischer →

Netflix Releases Polynote – A Polyglot Jupyter Notebook Variant

Netflix announced that they are releasing a new piece of open source software that they are calling Polynote. Polynote is an IDE-inspired polyglot notebook that includes first-class Scala support, Python and SQL. Looking at the website, it appears to be built on top of Jupyter Notebook. Their top goals for the project are reproducibility and visibility. You can read the full announcement with examples on Medium. This looks like an interesting project and I am curious to see how it impacts Project Jupyter. My personal hope is that Netflix’s work will be useful to the Python community and perhaps enhance Jupyter Notebook and JupyterLab. I like that it this notebook allows each cell to run a different language out of the box. You can do that with Jupyter Notebook, but doing so is a bit clunky and nowhere near as user-friendly as using a drop-down control like the one that Polynote is using. It is also interesting that Polynote stores its configuration and dependencies in the notebook’s code itself. Polynote also supports robust data visualization using Vega and Matplotlib. Check out Polynote here.

A Brief Intro to PySimpleGUI

Creating graphical user interfaces (GUI) can be difficult. There are many different Python GUI toolkits to choose from. The top three that you are likely to see mentioned the most often are Tkinter, wxPython and PyQt (or PySide2). However there is a newer toolkit called PySimpleGUI that aims to make creating GUIs easier. The way that PySimpleGUI gets its power is by being an abstraction layer on top of Tkinter, wxPython and PyQt. You can kind of think of PySimpleGUI as a wrapper. The developers behind PySimpleGUI have also recently added a 4th wrapper around Remi, which is a “GUI library for Python applications which transpiles an application’s interface into HTML to be rendered in a web browser”. Installing PySimpleGUI Installing PySimpleGUI is a snap if you know how to use pip. Here’s the command you should run: pip install pysimplegui Note that this will install PySimpleGUI to your system Python. You may want to install it to a Virtual Python environment instead. You can use Python’s venv module to do that. Check it out! Hello PySimpleGUI When it comes to working with GUIs, it’s always easier to see how you might put one together yourself. Let’s write little form that takes a string and has two buttons: an OK button and an Cancel button. This example is based on one from the PySimpleGUI User’s Manual: import PySimpleGUI as sg   # Create some widgets text = sg.Text("What's your name?") text_entry = sg.InputText() ok_btn = sg.Button('OK') cancel_btn = sg.Button('Cancel') layout = [[text, text_entry], [ok_btn, cancel_btn]]   # Create the Window window = sg.Window('Hello PySimpleGUI', layout)   # Create the event loop while True: event, values = window.read() if event in (None, 'Cancel'): # User closed the Window or hit the Cancel button break print(f'Event: {event}') print(str(values))   window.close() Here you import PySimpleGUI and then you create a series of widgets: Text, InputText and two Buttons. To layout the widgets in rows, you can add them to lists. So for the first row of widgets, you create a list that contains the Text widget followed by the InputText widget. The widgets are added from left-to-right horizontally. To add a second row, you add a second list of widgets, which contains the two buttons. After you have all your widgets in a nested set of lists, you can create the Window. This is the parent widget that contains all the other widgets. It has a title and accepts your nested list of widgets. Finally you create an while loop and call the Window’s read() method to extract the events and values that the user has set. If the user presses the Cancel button or closes the Window, you catch that and break out of the loop. Otherwise you print out the event and any value the user has entered. This is what the GUI should look like when you run your code: Let’s say you enter the string “mike” in the text entry widget and then hit the OK button. You should see the following output in your terminal: Event: OK {0: 'mike'} Wouldn’t it be nice if you could redirect stdout to a debug window in your GUI though? PySimpleGUI actually has an easy way to do that. All you need to do is update your print statement in the code above to the following: sg.Print(f'Event: {event}') sg.Print(str(values)) Now when you run the code and enter a string and press OK, you should see the following debug window: PySimpleGUI Widgets There isn’t enough time to go over every widget that PySimpleGUI supports. However you can see which widgets are supported by going to this part of the documentation. There is a note in the documentation that mentions that Table widget currently has issues. It is implied that the Tree widget is also problematic, but doesn’t really talk about why. This should get better if the developers behind PySimpleGUI can finish wrapping wxPython’s widgets or Qt’s as they both have robust table and tree widgets. Creating Multiple Windows One thing that I see a lot of new programmers struggle with is opening multiple windows in their GUI toolkit of choice. Fortunately, PySimpleGUI has directions of how to do this clearly labeled. They actually have two different “design patterns” for doing this sort of thing. For brevity, I’ll only show how to do two active windows: import PySimpleGUI as sg   # Create some widgets ok_btn = sg.Button('Open Second Window') cancel_btn = sg.Button('Cancel') layout = [[ok_btn, cancel_btn]]   # Create the first Window window = sg.Window('Window 1', layout)   win2_active = False   # Create the event loop while True: event1, values1 = window.read(timeout=100)   if event1 in (None, 'Cancel'): # User closed the Window or hit the Cancel button break   if not win2_active and event1 == 'Open Second Window': win2_active = True layout2 = [[sg.Text('Window 2')], [sg.Button('Exit')]]   window2 = sg.Window('Window 2', layout2)   if win2_active: events2, values2 = window2.Read(timeout=100) if events2 is None or events2 == 'Exit': win2_active = False window2.close()   window.close() The first few lines are pretty similar to the first example in this article. This time around you will create the main application with only two buttons. One of the buttons is used for opening a second window while the other button is used for closing the program. Next you set a flag, win2_active, to False and then start your “event loop”. Inside of the event loop, you check if to see if the user has pressed the “Open Second Window” button. If they have, then you open the second window and watch for its events too. Personally I find this kind of clunky to work with. I think a lot of this could be improved by using some classes for the Windows and abstracting the main loop. I wouldn’t want to have to deal with creating a lot of windows using this kind of pattern as it looks like it would get very complex very quickly to me. But I haven’t used this package enough to know if there are already good workarounds for this. Wrapping Up PySimpleGUI is a neat library and I like that it tries to be a bit more “Pythonic” than wxPython and PyQt tend to be. Of course, if you are looking for a GUI that uses a more Pythonic approach versus a C++ approach, you might want to check out Toga or Kivy. Anyway, I think PySimpleGUI looks like it has a lot of interesting features. The widget set seems a bit small out of the box, but as they wrap other toolkits more this will be less of an issue. Frankly, they have a lot of cool demo applications on their site as well as a demo application for the project itself. They also have information on turning your application into an executable on Windows and Mac using PyInstaller, which is something you don’t normally see in the documentation for a GUI toolkit. If you are looking for a simple GUI toolkit, PySimpleGUI might be right up your alley.

home/2019/10/23/75c23a1a281b7152d1acc9ab624e655fc727b049.jpg

Python and PyQt: Building a GUI Desktop Calculator

In this step-by-step tutorial, you'll learn how to create Graphical User Interface (GUI) applications with Python and PyQt. Once you've covered the basics, you'll build a fully-functional desktop calculator that can respond to user events with concrete actions.

home/2019/10/22/6c3a3aa4711c2cc7bf682ecdaf5cbd64b6d3f79d.jpg

Python Plotting With Matplotlib

In this beginner-friendly course, you'll learn about plotting in Python with matplotlib by looking at the theory and following along with practical examples.

home/2019/10/21/ea90767b27794c920eee51eb841126255c9f2d9e.jpg

Arduino With Python: How to Get Started

In this step-by-step tutorial, you'll discover how to use Arduino with Python to develop your own electronic projects. You'll learn how to set up circuits and write applications with the Firmata protocol. You'll control Arduino inputs and outputs and integrate the board with higher-level apps.

PyDev of the Week: Sophy Wong

This week we welcome Sophy Wong (@sophywong) as our PyDev of the Week! Sophy is a maker who uses Circuit Python for creating wearables. She is also a writer and speaker at Maker events. You can see some of her creations on her Youtube Channel or her website. Let’s take a few moments to get to know her better! Can you tell us a little about yourself (hobbies, education, etc): I am a designer and maker currently working mostly with wearable electronics projects. My background is in graphic design, and I have also worked in fashion and costumes on my way to wearable electronics. I like to explore the different ways people interact with technology, and much of my work is inspired by sci-fi and pop culture. My projects often combine technology, like microcontrollers and 3D printing, with hand crafts like sculpting, painting, and sewing. Continue reading PyDev of the Week: Sophy Wong →

home/2019/10/16/1d03bc5ddcdf7e9082c9df707ef234fbb3dce171.jpg

Basic Data Types in Python 3: Strings

There is a lot to learn on your Python journey when you are new to the programming language. Once you are comfortable writing and executing code, your first stop becomes understanding how to represent data in your code. No matter the language, there are a few basic data types you'll use all the time... (read more)

home/2019/10/16/019a76f7acc1430126453015ce675bec90c9884e.jpg

Python sleep(): How to Add Time Delays to Your Code

In this tutorial, you'll learn how to add time delays to your Python programs. You'll use decorators and the built-in time module to add Python sleep() calls to your code. Then, you'll discover how time delays work with threads, asynchronous functions, and graphical user interfaces.

home/2019/10/15/e738d8ec62864d7d83551d4c5bf27b950fec32c2.jpg

The Python range() Function

In this step-by-step course, you'll master the Python range() function, learn how its implementation differs in Python 3 vs 2, and see how you can use it to write faster and more Pythonic code.

home/2019/10/14/58cfad565bdafbbdd21fd48da674367f44f87ec4.jpg

Cool New Features in Python 3.8

What does Python 3.8 bring to the table? Learn about some of the biggest changes and see you how you can best make use of them.

PyDev of the Week: Elana Hashman

This week we welcome Elana Hashman (@ehashdn) as our PyDev of the Week! Elana is a director of the Open Source Initiative and a fellow of the Python Software Foundation. She is also the Clojure Packaging Team lead and a Java Packaging Team member. You can see some of her work over on Github. You can also learn more about Elana on her website. Let’s take a few moments to get to know her better! Can you tell us a little about yourself (hobbies, education, etc): I love to bake and cook, so my Twitter feed tends to be full of various bread pictures or whatever dish I’ve whipped up over the weekend. When I was a kid, I was completely hooked on the cooking channel—my favourite shows were “Iron Chef” and “Good Eats”—and I thought I’d become a chef when I grew up. That’s my back up plan if I ever drop out of tech! I’m Canadian, and I attended the University of Waterloo in Ontario to study mathematics, majoring in Combinatorics & Optimization with a Computer Science minor. The University of Waterloo is famous for its co-operative study program, where students take an extra year to finish their degrees and forfeit their summers off to complete 5-6 paid co-op work terms. To give my schedule a bit more flexibility, I actually dropped out of the co-op program, but prior to graduating I completed 4 co-op terms, a Google Summer of Code internship, some consulting, and even became an open source maintainer. I learned how to admin servers for the Computer Science Club, and a group of my friends and I revived the Amateur Radio Club after it had been inactive for a decade. Amateur (or “ham”) radio got me into playing with electronics, so I learned how to solder and now I occasionally build cool things like the PiDP-11 kit. And now that I can solder a PCB, I want to see if I can solder silver, so I’m signing up to take some jewellery-making classes this fall. I also take care of a bunch of wonderful, mostly low-maintenance houseplants. One day I hope to have a full-sized backyard for growing vegetables and setting up radio antennas! Continue reading PyDev of the Week: Elana Hashman →

Thousands of Scientific Papers May be Invalid Due to Misunderstanding Python

It was recently discovered that several thousand scientific articles could be invalid in their conclusions because scientists did not understand that Python’s glob.glob() does not return sorted results. This is being reported on by Vice, Slashdot and there’s an interesting discussion going on over on Reddit as well. Some are reporting this as a glitch in Python, but glob has never guaranteed that is results were returned sorted. As always, I would recommend reading the documentation closely to fully understand what your code does. It would also be a good idea if you can write tests around your code. Python includes a unittest module which makes this easier.

home/2019/10/09/8ef39069ea4011f7bbf5c3fabcdb6e294c1fcc99.jpg

Emacs: The Best Python Editor?

In this step-by-step tutorial, you'll learn about using Emacs for Python development. You'll install and configure Emacs on your selected platform, then write Python code to explore its capabilities. Finally, you'll run, test, and debug Python code in the Emacs environment.

home/2019/10/08/7dd3e2a57262c040192633d8a5975821f8865152.jpg

Get Started With Django: Build a Portfolio App

In this course, you'll learn the basics of creating powerful web applications with Django, a Python web framework. You'll build a portfolio website to showcase your web development projects, complete with a fully functioning blog.

home/2019/10/07/3575df332023c841bf971634933349eafef304d5.jpg

Building a Python C Extension Module

In this tutorial, you'll learn how to write Python interfaces in C. Find out how to invoke C functions from within Python and build Python C extension modules. You'll learn how to parse arguments, return values, and raise custom exceptions using the Python API.

PyDev of the Week: Paul Ivanov

This week we welcome Paul Ivanov (@ivanov) as our PyDev of the Week! Paul is a core developer of IPython and Jupyter. He is also an instructor at Software Carpentry. You can learn more about Paul on his website. You can also see what he’s been up to in open source by visiting his Github profile. Let’s take some time to get to know Paul! Can you tell us a little about yourself (hobbies, education, etc): I grew up in Moscow and moved to the United States with my family when I was 10. I have lived in Northern California ever since. I earned a degree in Computer Science at UC Davis. After that, I worked on a Ph.D. in Vision Science at UC Berkeley. I really enjoy a lot of different aspects of computing, be it tinkering with hardware (especially microcontrollers) and trying out different operating systems and programming languages. Outside of things involving a keyboard, my main hobby is endurance cycling. I have a touring bike with a front basket that I’ve ridden on for a dozen 200km, two 300km, two 400km and one 600km rides. I also write in my journal (the pen and paper kind), which sometimes turns into poetry, some of which I have posted on my website. Continue reading PyDev of the Week: Paul Ivanov →

home/2019/10/02/97c1cb0091770c2173b59d0624b20415b31e235b.jpg

Using the Python zip() Function for Parallel Iteration

In this step-by-step tutorial, you'll learn how to use the Python zip() function to solve common programming problems. You'll learn how to traverse multiple iterables in parallel and create dictionaries with just a few lines of code.

home/2019/10/01/9c3d6fb0bc402079a393e0dbb7e5b51e61d93c2a.jpg

Strings and Character Data in Python

In this course, you'll learn how to use Python's rich set of operators, functions, and methods for working with strings. You'll learn how to access and extract portions of strings, and also become familiar with the methods that are available to manipulate and modify string data in Python 3.

home/2019/09/30/8cdfb15a4d691efa53e8b18b198f0abefafaf138.jpg

Preventing SQL Injection Attacks With Python

SQL injection attacks are one of the most common web application security risks. In this step-by-step tutorial, you'll learn how you can prevent Python SQL injection. You'll learn how to compose SQL queries with parameters, as well as how to safely execute those queries in your database.

PyDev of the Week: Marlene Mhangami

This week we welcome Marlene Mhangami (@marlene_zw) as our PyDev of the Week! Marlene is the PyCon Africa (@pyconafrica) chair, the co-founder of @zimbopy and a director for the Python Software Foundation. Let’s spend some time getting to know her! Can you tell us a little about yourself (hobbies, education, etc): Sure, in college I studied molecular biology. I was actually in the schools pre-medicine track because I initially thought I wanted to become a doctor. Looking back on it now I laugh because I hate blood, just the sight of it in movies makes me shut my eyes tightly, so I’m genuinely happy that didn’t work out! I went to a liberal arts college and appreciate that I had the space to take courses in other fields like philosophy and politics which I really enjoy. I get asked about what hobbies I have quite often, and I’m not sure if I have anything I do consistently enough to call a hobby. I read, and sometimes run, and love to journal. I also occasionally paint, but the last time I told someone I painted they asked me where my studios were and started listing off artists that I had never heard of before, so I like to disclaimer that I don’t paint in a way that is cultured or sophisticated but just as a way to express myself and have fun. Continue reading PyDev of the Week: Marlene Mhangami →

Older Posts