- 博客(20)
- 收藏
- 关注
转载 4: Create A Virtualenv( Challenge: Working with the Command Line)
You'll want to isolate the Python environment that your script is in by creating a virtual environment. This will allow you to install Python packages with the versions that the script expects.
2016-09-14 12:20:29
255
转载 3: Change File Permissions(Challenge: Working with the Command Line)
You don't want just anyone to be able to run your script. By editing permissions, you can make it so that only you can run the script. Instructions Edit the file permissions for sc
2016-09-14 12:09:00
315
转载 2: Creating A Script( Challenge: Working with the Command Line )
You'll now be able to create a Python script in the current folder. Instructions Create a Python script that takes in a command line argument and prints it. Use output redirecti
2016-09-14 11:57:41
275
转载 1: Command Line Python(Challenge: Working with the Command Line)
In the past few missions, you learned how to navigate the filesystem, create and modify files, and work with Python on the command line. You learned that it isn't enough to just know how to program in
2016-09-14 11:51:14
211
转载 10: Deactivating A Virtualenv(Command line Python scripting )
When you want to switch a virtualenv off so you can move to a different project, you can deactivate it with the deactivate command. You don't have to pass in the virtualenv name to the deactivate co
2016-09-14 11:48:47
242
转载 9: Command Line Arguments(Command line Python scripting)
You can also pass command line options into Python scripts. They can be retrieved inside the script using the sys package. The argv list allows you to retrieve the positional arguments passed into
2016-09-14 11:38:02
824
转载 8: Importing A File(Command line Python scripting)
One of the great things about Python is that we can import functions from one package into a file. We can also import functions and classes from one file into another file. This gives us a powerful wa
2016-09-14 02:17:42
285
转载 7: Checking The Installed Packages(Command line Python scripting)
You can check the version of Python you're using with python -V. You can check which packages are currently installed and their versions withpip freeze. If you activate a virtualenv, all the packa
2016-09-14 02:11:34
271
转载 6: Activating A Virtualenv( Command line Python scripting )
Once a virtualenv is created, you can activate it using source python3/bin/activate (this assumes that the virtualenv is called python3, and the folder for the virtualenv is in our current directo
2016-09-14 02:07:57
197
转载 5: Python 3 Virtualenv(Command line Python scripting )
By default, virtualenv will use the pythonexecutable when it makes a new virtualenv, which means that it has the same version of Python as the system. In this case, we want to use python3 instead
2016-09-14 02:04:26
172
转载 4: Virtual Environments(Command line Python scripting )
In the previous screen, we used the default version of pip, which installed requests for thepython executable, which is Python version 2. What if we had instead wanted to installrequests for Py
2016-09-14 01:50:12
214
转载 3: Installing Packages(Command line Python scripting )
Packages are an important way to extend the functionality of Python. We've worked with packages like matplotlib and pandas. The best way to install packages is to use the command line, and a program
2016-09-14 01:47:55
262
转载 2: Python Versions(Command line Python scripting)
2: Python Versions There are actually two versions of Python on this machine. We ran the last script using the defaultpython executable, which is Python version 2. We'll instead want to use P
2016-09-14 01:45:12
229
原创 1: Command Line Python(Command line Python scripting)
We looked at the command line Python interpreter in the last mission. The interpreter lets you run Python commands and see their results immediately. It's very useful for quickly testing snippets of c
2016-09-14 01:40:24
511
原创 compution average in python: mean(),pivot_table()
import pandas as pd # This is the same value that we computed in the last screen, but it's much simpler. # The ease of using the .mean() method is great, but it's important to understand how the
2016-09-08 19:54:20
453
原创 titanic survival 2
#########hte idea is to create an table which contains just 1's and 0's.The array will be a surbibal reference table.whereby you read in the ##########tet data,find out passenger attributes,look the
2016-07-25 16:48:25
347
原创 titanic survival 1
###python has a nice csv reader,which reads each line of a file into memory.You can read in each row and just append a list.From there,you can ####quickly trun it into an array.The first thing to do
2016-07-25 14:35:44
282
原创 CSVs in Python 1
#Representing a CSV as a list of rows #Option 1: Each row is a list csv=[['A1','A2','A3'], ['B1','B2','B3']] #Option 2:Each row is a dictionary csv=[{'name1':'A1','name2'
2016-07-22 21:24:56
182
原创 CSVs in Python 2
##### the first way import unicodecsv def read_csv(filename): with open('enrollments.csv','rb') as f : reader=unicodecsv.DictReader(f) enrollments=list(reader) with open('daily_enga
2016-07-22 21:22:33
567
原创 CSVs in Python
#Representing a CSV as a list of rows #Option 1: Each row is a list csv=[['A1','A2','A3'], ['B1','B2','B3']] #Option 2:Each row is a dictionary csv=[{'name1':'A1','name2'
2016-07-22 20:34:37
339
1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅