使用beautifulsoup,我一直试图将HTML的所有内容保存到.txt文件中。但是,当我尝试使用在网上找到的几个想法时,我会不断丢失一些数据,并且输出结果也会有所不同。
我要保存的文件仅包含文本(与音乐相关的内容,这会使事情变得有些复杂)。这是我要保存的链接: http://kern.humdrum.org/cgi-bin/ksdata?l=users/craig/classical/beethoven/piano/sonata&file=sonata01-1.krn&f=kern
请注意,我已经在步骤中松开了以下行:
public class MyCustomStoreType<K,V> implements QueryableStoreType<MyReadableCustomStore<K,V>> {
// Only accept StateStores that are of type MyCustomStore
public boolean accepts(final StateStore stateStore) {
return stateStore instanceOf MyCustomStore;
}
public MyReadableCustomStore<K,V> create(final StateStoreProvider storeProvider, final String storeName) {
return new MyCustomStoreTypeWrapper(storeProvider, storeName, this);
}
}
我的代码:
enter code here
static void Main(string[] args)
{
int N = int.Parse(Console.ReadLine());
//Console.WriteLine(N);
int a = N % 10;
int b = ((N / 10) % 10);
int c = ((N / 100) % 10);
int sum = 0;
//Console.WriteLine(X);
//Console.WriteLine(Y);
//Console.WriteLine(Z);
if ((a > 1) && (b > 1) && (c > 1))
{
Console.WriteLine(a * b * c);
}
if ((a == 0) && ((b <= 1) || (c <= 1)))
{
Console.WriteLine(b + c);
}
if ((a == 0) && ((b > 1) && (c > 1)))
{
Console.WriteLine(b * c);
}
if ((a == 1) && (b > 1) && (c > 1))
{
Console.WriteLine(a + b * c);
}
if ((a == 1) && ((b <= 1) || (c <= 1)))
{
Console.WriteLine(a + b + c);
}
if ((a > 1) && ((b <= 1) && (c <= 1)))
{
Console.WriteLine(a + b + c);
}
if ((a > 1) && (b == 1) && (c > 1))
{
Console.WriteLine(a * b * c);
}
if ((a > 1) && (b == 0) && (c > 1))
{
Console.WriteLine(a + b + c);
}
if ((a > 1) && (b > 1) && (c <= 1))
{
Console.WriteLine(a * b + c);
}
}
}
对于此文件,我正在丢失3个大数据块;这些块位于文件的中间,位于原始内容的第二部分;