我有一个名字的文件-q
(看起来这是偶然的)
我想看看它的内容,所以我尝试了这些
$ cat '-q'
$ cat "-q"
$ cat $'-q'
Run Code Online (Sandbox Code Playgroud)
但没有任何效果.(所有给出相同的错误cat: invalid option -- 'q'
)
有没有办法看到它的内容?
我一直在分析一个源代码,但我仍然试图理解这两个^=
在这个评估中一起做的事情:
array[i] ^= 5;
Run Code Online (Sandbox Code Playgroud)
什么是^=
操作数代表什么?这样做了吗?:
array[i] = array[i] ^ 5;
Run Code Online (Sandbox Code Playgroud)
谢谢..
我知道两者的价值是相同的(比如说3到4).但是,计算机是否将两者视为相同,它们是否都被视为表达式?
提前致谢!
我正在尝试制作一个程序来计算错过课程的费用.我接受一个学期的变量学费,课程数和周数; 然后绘制结果(使用python 2.7).这是我一直在研究的代码:
import matplotlib.pyplot as plot
def calculations(t, c, w, wk):
two_week = (((t/c)/w)/2)*wk
three_week = (((t/c)/w)/3)*wk
return two_week, three_week
def main():
tuition = float(raw_input('Tuition cost (not including fees): '))
courses = int(raw_input('Number of courses: '))
weeks = int(raw_input('Number of weeks in the semester: '))
x_axis = range(0,10)
y_axis = []
y_axis2 = []
for week in x_axis:
cost_two, cost_three = calculations(tuition, courses, weeks, week)
y_axis += [cost_two]
y_axis2 += [cost_three]
plot.plot(x_axis, y_axis ,marker='o', label='course meets 2x a week', …
Run Code Online (Sandbox Code Playgroud)