在学习Scipy的leastsq扩展的时候,发现在中文前会用到'u'标签,这是干什么用的?
例如下述两行代码:
print u'真实参数',[A,k,theta]
pl.plot(x,y1,label = u'噪声数据')
为什么要加入u标签呢?否则中文报错!
#include <iostream> | |
using namespace std; | |
int main(){ | |
int x = 10; | |
while(x --> 0){ | |
cout << x << endl; | |
} | |
return 0; | |
} |
#include <iostream> | |
using namespace std; | |
void swap(int* a,int& b){ | |
int t = *a; | |
*a = b; | |
b = t; | |
} | |
void swap(int& a,int& b){ | |
int t = move(a); |
def add(x): | |
return x + 100 | |
data = [11,22,33] | |
dict = {} | |
dict = map(add,data) | |
print dict |
在学习Scipy的leastsq扩展的时候,发现在中文前会用到'u'标签,这是干什么用的?
例如下述两行代码:
print u'真实参数',[A,k,theta]
pl.plot(x,y1,label = u'噪声数据')
为什么要加入u标签呢?否则中文报错!
import numpy as np | |
from matplotlib import pylab as plt | |
#from mpltools import style # uncomment for prettier plots | |
#style.use(['ggplot']) | |
''' | |
function definitions | |
''' | |
# generate all bernoulli rewards ahead of time | |
def generate_bernoulli_bandit_data(num_samples,K): |