Python StringIO And BytesIO Example
Python StringIO and BytesIO are methods that manipulate string and bytes data in memory, this make memory data manipulation use the consistent API as read and write files. StringIO is used to operate string data, and if you want to manipulate binary data, you need to use BytesIO. This article will give you some example …
iOS 11 Hello World Example
This article takes an iOS 11 application as an example to show developers how to create projects using Xcode 10. It also shows some functions of the iOS simulator and interface builder. 1. Create iOS Project. All the files for an iOS application are saved under a Xcode project. Project can help user to manage …
Python Read Write File Example
Read and write files is the most common IO operation. Python has built-in functions for read and write files, and the usage is compatible with C. The ability to read and write files on disk is provided by the operating system, modern operating systems do not allow programs to operate directly on disks. So, to …
iOS Autolayout Introduction
How did you set up UI layout in older iOS application development? Write a lot of coordinate calculation code? To ensure a perfect UI effect on both the 3.5-inch and 4.0-inch screens, you sometimes have to write different coordinate calculations for each screen? But now with iOS autolayout function, things change to better.
Python Pickle Object Serialization Example
Pickle is a python module which implements the protocol for serializing and deserializing python object. It can converts python objects into binary format data and then save the object in hard disk. It can also load the already saved data from disk file and restore it back to original python object. This is useful for …
Python Immutable Objects
For mutable objects, such as a list, to operate on a list, the contents within the list will change, for example. >>> l = [‘f’, ‘e’, ‘d’] >>> l.sort() >>> ; [‘d’, ‘e’, ‘f’] What about immutable objects, like string. >>> str = ‘hello’ >>> str.replace(‘h’, ‘F’) ‘Fello’ >>> str ‘hello’ Even though the string …
Python Dict And Set Example
1. Python Dict Introduction. Python has a built-in dictionary: dict. It is also called map in other coding languages, using key-value storage, it has an extremely fast lookup speed. For example, suppose you want to find the corresponding score according to the student’s name. If you use list, you need two lists. names = [‘Tom’, …
Python List And Tuple Example
1. Python List One of Python’s built-in data types is list. A list is an ordered collection of elements that can be added and removed at any time. Below is an example of python list. The variable employees is a list. You can use the len() function to get the number of list elements >>> …
Python Parse Html Page With XPath Example
Python can be used to write a web page crawler to download web pages. But the web page content is massive and not clear for us to use, we need to filter out the useful data that we need. This article will tell you how to parse the downloaded web page content and filter out …