尝试使用pip从cmd安装Django.
Python 2.7.3, Windows 7
Env var(...C:\Python27;C:\Python27\Lib\site-packages\;C:\Python27\Scripts\;)
help("pip")
.
.
.
.
VERSION
1.3.1
pip install Django
File "<stdin>", line 1
pip install Django
^
SyntaxError: invalid syntax
Run Code Online (Sandbox Code Playgroud) 在Flask教程之后,运行Win 7,Python 2.7.3,virtualenv,我陷入了第3步:创建数据库http://flask.pocoo.org/docs/tutorial/dbinit/#tutorial-dbinit
可以通过将schema.sql文件传递到sqlite3命令来创建这样的模式,如下所示:
Run Code Online (Sandbox Code Playgroud)sqlite3 /tmp/flaskr.db < schema.sql
如何运行此命令,因为CMD <venv>返回:
"sqlite3"未被识别为内部或外部命令,可操作程序或批处理文件.
这一步是否必要?
Folder Project,2个文件schema.sql和flaskr.py.
schema.sql文件
drop table if exists entries;
create table entries (
id integer primary key autoincrement,
title string not null,
text string not null
);
Run Code Online (Sandbox Code Playgroud)
flaskr.py
# all the imports
import sqlite3
from flask import Flask, request, session, g, redirect, url_for, \
abort, render_template, flash
from contextlib import closing
# configuration
DATABASE = '/tmp/flaskr.db'
DEBUG = True
SECRET_KEY = 'development key'
USERNAME = 'admin'
PASSWORD = …Run Code Online (Sandbox Code Playgroud) 我正在制作检查字符串(电子邮件)的算法 - 就像"电子邮件地址有效",但它们是规则.电子邮件的第一部分必须是包含1-8个字符的字符串(可以包含字母,数字,下划线[_] ...电子邮件包含的所有部分)以及@电子邮件的第二部分之后拥有1-12个字符的字符串(也包含所有合法表达式),它必须以顶级域名.com结尾
email = raw_input ("Enter the e-mail address:")
length = len (email)
if length > 20
print "Address is too long"
elif lenght < 7:
print "Address is too short"
if not email.endswith (".com"):
print "Address doesn't contain correct domain ending"
try:
first_part = len (splitting[0])
second_part = len(splitting[1])
account = splitting[0]
domain = splitting[1]
list = "abcdefghijklmopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_."
for c in account:
if c not in list:
print "Invalid char", "->", c,"<-", "in account name of e-mail" …Run Code Online (Sandbox Code Playgroud)