你能解释一下原因吗?
这个给了$?= 1
echo "uus" | grep -w -o [0123456789]\*
Run Code Online (Sandbox Code Playgroud)
这一个给$?= 0
echo "-uus" | grep -w -o [0123456789]\*
Run Code Online (Sandbox Code Playgroud) 我有
$ cat awktestf
a++
b++
c++
Run Code Online (Sandbox Code Playgroud)
我正在做,我得到了
cat awktestf | awk 'BEGIN { RS="++" ; OFS="@"; ORS="()" } { print $0 } END {print "I am done" }'
a()
b()
c()
()I am done()abc@abc:~$
Run Code Online (Sandbox Code Playgroud)
我的问题是为什么我最后得到一个额外的()?
即便这样也行不通:
$ echo 'a++
> b++
> c++' | awk 'BEGIN { RS="++" ; OFS="@"; ORS="()" } { print $0 } END {print "I am done" }'
a()
b()
c()
()I am done()abc@abc:~$
Run Code Online (Sandbox Code Playgroud) 我有
#!/bin/sh
func1()
{
echo "This is func1 from shell script"
}
func2()
{
echo "This is func2 from shell script"
}
Run Code Online (Sandbox Code Playgroud)
我想从C程序调用func1和func2.我能这样做吗?
我没有发布整个代码.我有这个:
public class LinkedList2<T extends Comparable<T>> implements Iterable<T> {
private Node<T> head;
private Node<T> tail;
private int numOfElem;
private class Node<T> {
Node<T> next;
T data;
Node(Node<T> next, T data) {
this.next = next;
this.data = data;
}
}
private class LinkedList2Iterator<T> implements Iterator<T> {
private int count = LinkedList2.this.numOfElem;
private Node<T> current = LinkedList2.this.head;
}
}
Run Code Online (Sandbox Code Playgroud)
在javac -Xlint LinkedList2.java
我得到这个错误:
LinkedList2.java:134: incompatible types
found : LinkedList2<T>.Node<T>
required: LinkedList2<T>.Node<T>
private Node<T> current = LinkedList2.this.head;
^
1 error
Run Code Online (Sandbox Code Playgroud)
你能帮我吗?
我有这个
abc@abc-ubuntu:~/project1/wh-app-ios$ git branch -a -v -v
* master 1d35af1 [origin/master: ahead 2] Adding 123 to hello
remotes/gitb/gh-pages e3dad9d boom
remotes/gitb/integration 1d3fcd5 Adding 55_Glossary chapter
remotes/gitb/master 86d1d30 Merge remote-tracking branch 'origin/master'
remotes/gitb/pt_BR dc9d991 Revisions at 03, 07, 08, 09, 10, 11 and 50
remotes/origin/HEAD -> origin/master
remotes/origin/master 1ae426b Update README.md
Run Code Online (Sandbox Code Playgroud)
我做
abc@abc-ubuntu:~/project1/wh-app-ios$ git checkout gitb/master
Note: checking out 'gitb/master'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any …
Run Code Online (Sandbox Code Playgroud) 我有这个
#include<stdio.h>
#include<stdlib.h>
int main() {
int a = getw(stdin);
if(ferror(stdin)) {
printf("error occurred\n");
exit(1);
}
printf("%u\n", a);
}
Run Code Online (Sandbox Code Playgroud)
而我得到:
$ ./readstdin
9876
909588537
Run Code Online (Sandbox Code Playgroud)
你能帮忙解释一下产量吗?
我的机器:Linux abc-ubuntu 3.2.0-65-generic#98-Ubuntu SMP Wed Jun 11 20:27:07 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
我有
hd.meta(http-equiv='Content-Type', content='text/html;charset=UTF-8')
Run Code Online (Sandbox Code Playgroud)
我得到了:
SyntaxError:关键字不能是表达式
为什么这样 ?
我正在使用我公司的 smtp 服务器使用 python 的电子邮件模块发送电子邮件。当我这样做时,我的电子邮件 html 无法正确呈现。这是我得到的:
sender = 'abc@abc.com'
# Create message container - the correct MIME type is multipart/alternative.
msg = MIMEMultipart('multipart')
msg['Subject'] = "My Report"
msg['From'] = sender
msg['To'] = ", ".join(recipients)
# Create the body of the message using html in msg_body
h = unicode(msg_body).encode("utf-8", "ignore")
# Record the MIME type
part = MIMEText(h, 'html')
# Attach parts into message container.
msg.attach(part)
pngfiles = ['image.png']
for file in pngfiles:
# Open the files in binary mode. …
Run Code Online (Sandbox Code Playgroud) class TestClass(object):
aa = lambda x: 35
def __init__(self):
self.k = self.aa()
o = TestClass()
print o.k
Run Code Online (Sandbox Code Playgroud)
这给了我35,我理解为什么.
但是这个:
class TestClass(object):
@classmethod
aa = lambda x: 35
print type(aa)
def __init__(self):
self.k = TestClass.aa()
o = TestClass()
print o.k
Run Code Online (Sandbox Code Playgroud)
这给了我
File "test1.py", line 3
aa = lambda x: 35
^
SyntaxError: invalid syntax
Run Code Online (Sandbox Code Playgroud)
为什么这样 ?
class test(object):
def __init__(self):
pass
def __iter__(self):
return "my string"
o = test()
print iter(o)
Run Code Online (Sandbox Code Playgroud)
为什么这会追溯?
$ python iter_implement.py
Traceback (most recent call last):
File "iter_implement.py", line 9, in <module>
print iter(o)
TypeError: iter() returned non-iterator of type 'str'
Run Code Online (Sandbox Code Playgroud)
我希望__iter__
在这种情况下只返回字符串.何时以及为什么检测到返回的对象不是迭代器对象?